<template>
	<AplidForm v-model="formModel" v-bind="formConfig" ref="formEl" @reset="onReset" @submit="onSubmit"> </AplidForm>
</template>

<script setup lang="ts">
import apiMod from '@/apiMod/index'
import { ElMessage } from 'element-plus'
const props = defineProps<{
	nowRowData?: any
	api: any
}>()

const emit = defineEmits(['refresh'])

const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
		{
			label: '处理备注',
			prop: 'handleNote',
			type: 'textarea',
			maxlength: '500',
			showWordLimit: true,
			autosize: {
				minRows: 1,
			},
			span: 24,
		},
		{
			label: '处理图片',
			prop: 'handlePic',
			type: 'upload',
			listType: 'picture-card',
			labelPosition: 'top',
			showFileList: true,
			limit: 4,
			multiple: true,
			changeField: true,
			span: 24,
		},
		{
			label: '签字照片',
			tip: '',
			prop: 'handleSignaturePic',
			type: 'upload',
			labelPosition: 'top',
			showFileList: false,
			limit: 1,
			multiple: false,
			span: 24,
		},
		{
			label: '签名',
			prop: 'handleSignatureText',
			type: 'input',
			span: 24,
		},
	],
}
const formModel = ref({})

const onReset = () => {}
const onSubmit = (form, done) => {
	apiMod[props.api.edit]({
		...props.nowRowData,
		...form,
    isHandle:2,
	})
		.then(() => {
			ElMessage.success('保存成功')
			emit('refresh')
			done()
		})
		.catch(() => {
			done()
		})
}
</script>

<style scoped></style>
